#include <bits/stdc++.h>
using namespace std;
int ft[100500];
int lv[100500];
multiset<int> s1,s2;
multiset<int> ::iterator it;

int main(){
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    int n;
    cin >> n;
    for(int i = 1; i <= n; i++){
        int r;
        cin >> r;
        ft[i] = r;
        lv[i] = 1;
        s1.insert(r);
        s2.insert(r);
    }
    sort(ft+1,ft+n+1);
    int cnt = 0;
    for(int i= 1; i <= n; i++){
        if(s1.upper_bound(ft[i]) == s1.end()){
            continue;
        }
        s1.erase(s1.upper_bound(ft[i]));
        s2.erase(s2.lower_bound(ft[i]));
    }
    cout << s2.size() << endl;
    return 0;
}
